#ifndef __WIZ_INNER_WINDOWS_ATOMIC_COUNT_HPP__SHANHAOBO_19800429__
#define __WIZ_INNER_WINDOWS_ATOMIC_COUNT_HPP__SHANHAOBO_19800429__

#include "../../../Include/System/WizAtomicCount.hpp"
#include "../../../Include/System/WizInterlocked.hpp"

namespace Wiz
{
    namespace Inner
    {
        namespace AtomicCount
        {
            namespace Windows
            {
                class Type : public ::Wiz::AtomicCount::Interface
                {
                protected:
                    LONG        m_Core;
                public:
                    Type() : m_Core(0)
                    {}
                    ~Type()
                    {
                        WIZ_ASSERT(m_Core == 0);
                    }
                public:
                    virtual ::Wiz::Void::Type Increment()
                    {
                        ::Wiz::Interlocked::Increment(&(this->m_Core));
                    }
                    virtual ::Wiz::Int::Type Decrement()
                    {
                        return ::Wiz::Cast::Static<::Wiz::Int::Type const>(::Wiz::Interlocked::Decrement(&(this->m_Core)));
                    }
                    virtual ::Wiz::Int::Type CompareSwap(::Wiz::Int::In Cmpr, ::Wiz::Int::In Swp)
                    {
                        return ::Wiz::Interlocked::CompareExchange(&(this->m_Core), Cmpr, Swp);
                    }
                    virtual ::Wiz::Int::Type Count()
                    {
                        return ::Wiz::Cast::Static<::Wiz::Int::Type const volatile&>(this->m_Core);
                    }
                };
            } /// end of namespace Windows
        } /// end of namespace AtomicCount
    } /// end of namespace Inner
} /// end of namespace Wiz


#endif /*__WIZ_INNER_WINDOWS_ATOMIC_COUNT_HPP__SHANHAOBO_19800429__*/
